﻿using Architecture.Domain.Service;
using Architeture.Domain;
using MediatR;
using RBAC.ZhuBoLin.Application.Command.RoleCommand.Healthinfo;

namespace RBAC.ZhuBoLin.Application.CommandHandlers.RoleHandler.Healthinfo
{
    public class HealthCreateCommandHandler : IRequestHandler<HealthCreateCommand, int>
    {
        protected readonly IHealthCareService healthCareService;

        public HealthCreateCommandHandler(IHealthCareService healthCareService)
        {
            this.healthCareService = healthCareService;
        }

        public async Task<int> Handle(HealthCreateCommand request, CancellationToken cancellationToken)
        {
            return await healthCareService.HealthAdd(new HealthCare() { GoodsInfoid = request.GoodsInfoid, DaysofFeeding = request.DaysofFeeding, HealthCareMode = request.HealthCareMode, ModeofOperation = request.ModeofOperation });
        }
    }
}
